Repository navigation
feat: extension browser-verbs + TanStack inspection adapter + first-party extension install - #126
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ry + Code Mode Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…te-firing proof Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Strip a leading mcp__<server>__ prefix before matching the risky set so approval: 'ask' extension tools are gated on the in-process/scripted path (codex permissionGate: 'none') and the mcp__tanstack__ bridge path, not only the mcp__conciv__ form. Risky set now holds bare names. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…t + duration Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… cards Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…arts reach the widget
…der the run by parent tool-call id
…erver MCP approve mode
…v guards, and outcome
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 259 out of 262 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (6)
packages/protocol/src/page-types.ts:41
extis now part ofPageQueryKindSchema, which also feeds the publicconciv_pagetool. That tool uses itsverbfield as the outer query kind, so anextcall cannot also provide the inner extension verb: destructuring removesverband dispatch always receives an empty verb. Keep this internal kind out ofPageInput(as the CLI already does), or give the inner field a non-conflicting wire name.
packages/page/src/page-verb-registry.ts:41- Malformed JSON is converted to
{}. A verb whose schema accepts an empty object therefore executes successfully with different arguments instead of returninginvalid-args, contradicting the typed failure contract. Preserve parse failure and return a structuredinvalid-argserror before dispatch.
packages/extension-compiler/src/extension-guard.ts:7 - This structural check accepts
{name: 'x'}asAnyExtension, although required builder members such asparseConfigare absent.dedupeExtensionsthen returns a value typed as mountable; server mounting fails later while the client silently treats it as an inert extension. Validate the required extension shape before narrowing.
packages/page/src/page-verb-registry.ts:67 - The serializer check accepts non-JSON collections such as
new Map([['a', 1]])becauseObject.values(map)is empty, but JSON transport silently changes that result to{}. Sparse arrays and symbol-keyed values have the same problem. Restrict objects to plain records and dense arrays so accepted values survive transport unchanged.
apps/conciv/src/router.ts:45 - Client factory execution is still outside any failure boundary. If one installed extension throws from
__client,createConcivRouterthrows andmountConcivsuppresses the rejection, leaving the entire widget unmounted. Isolate each factory here just as server extension mounting is isolated.
const dispose = bindExtensionPageVerbs(extension.name, result?.pageVerbs, result?.dispose)
return {extension, clientValue: result?.value ?? {}, dispose}
packages/plugin/src/core/extensions-entry.ts:6
- This generated TypeScript header violates the repository's no-comments rule and also contains a forbidden em dash. Remove the generated comment rather than excluding
.concivoutput from the checks.
| @@ -0,0 +1,36 @@ | |||
| import type {AnyExtension} from '@conciv/extension' | |||
| import {isExtension} from './extension-guard.js' | |||
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 259 out of 262 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (4)
packages/page/src/page-verb-registry.ts:41
- A malformed
argsJsonis silently replaced with{}, so a corrupted request can execute any verb whose schema accepts an empty object instead of returninginvalid-args. JSON decoding must fail closed before schema dispatch.
packages/page/src/page-verb-registry.ts:45 - Top-level
undefinedis silently converted tonull, even though the page caller's inferred result remainsundefined/void. This bypasses the non-serializable-result guard and changes the value across the wire; let the guard reject it instead.
packages/page/src/page-verb-registry.ts:67 - The serializability check accepts non-JSON objects such as
Date,Map, andSetbecauseObject.values()is empty. Those values then arrive as a string or{}, contradicting the inferred page-verb return type. Restrict accepted objects to arrays and plain records, and reject sparse/hidden properties that JSON would silently transform.
packages/plugin/src/core/extensions-entry.ts:6 - The repository's hard style rules prohibit em dashes. Replace this generated header punctuation with a hyphen; the matching test expectations must be updated as well.
| watcher.on('ready', () => writeExtensionsEntry(resolvedRoot)) | ||
| watcher.on('all', (event, path) => { | ||
| writeExtensionsEntry(resolvedRoot) | ||
| if (event === 'unlinkDir' && path === watchDir) rearm() |
| '@conciv/core': patch | ||
| --- | ||
|
|
||
| Tool cards render on every harness, and code-mode calls surface as real nested tool cards. Three fixes plus the phase-2 extension-owned cards: (1) tool names are normalized to their registered names before parts reach the widget — claude's `probe_ping`, opencode's `tanstack_probe_ping`, and transcript `mcp__<server>__` forms all map losslessly back to the registered dotted name, so a card written once matches everywhere. (2) codex bridged tools finally execute under `workspace-write`: codex was cancelling MCP tool calls awaiting an unanswerable approval prompt, fixed narrowly with `mcp_servers.tanstack.default_tools_approval_mode = "approve"` scoped to conciv's own bridge (conciv's approval gate still guards `approval: 'ask'` tools). (3) every extension tool invoked through code-mode `execute_typescript` now emits a real per-tool part carrying `metadata.parentToolCallId`, and the chat activity view nests those parts under the script run in a collapsible tool group — denies and throws render as errors, never green. New extension-owned cards: CanvasOpCard (op-aware `canvas.*` with thumbnails, count chips, red destructive ops), CommentOpCard (`comment.*` + `pin.setState`), RecordingToolCard (`recording_start/stop/pull` with action-log summary), and inline rows for `element.reference` / `anchor.resolve`. |
…ss lifetime in boot diagnostics
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 259 out of 262 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (4)
packages/core/src/chat/gate.ts:170
- Bridge-visible names are sanitized (
canvas.deletebecomescanvas_delete, and may arrive astanstack_canvas_deleteormcp__tanstack__canvas_delete), but this check only removes the MCP prefix. Those forms do not match the registeredriskyname, so anapproval: 'ask'tool can execute without prompting. Normalize the wire name against registered names here, or conservatively treat any sanitized match as risky.
packages/page/src/page-verb-registry.ts:67 - This accepts class instances such as
Date,Map, andSetbecause they have no enumerable values. JSON transport then converts them (Dateto a string,Map/Setto{}), soserver.page.callreturns a runtime value that contradicts its inferred handler return type. Restrict results to JSON primitives, arrays, and plain objects (including ignored symbol/non-enumerable properties), or validate an actual lossless JSON round trip.
packages/extensions/tanstack/src/client/query-adapter.ts:138 - The selected cache entry is identified by its full serialized key, but
invalidateQueries({queryKey})uses TanStack Query's prefix matching by default. Invalidating['todos']therefore also invalidates entries such as['todos', 1], despite the tool promising a specific query. Passexact: trueand update the local filter type.
packages/extensions/tanstack/src/client/query-adapter.ts:145 refetchQueriesalso performs prefix matching by default, so choosing one displayed key can refetch multiple related cache entries. Passexact: trueso this action remains scoped to the exact entry the agent selected, and update the local filter type.
…errupts navigation
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 259 out of 262 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (6)
packages/page/src/page-verb-registry.ts:45
- This coerces a handler's
undefinedresult tonull, butPageCallerpromises the handler's inferred return type. ApageVerb(..., () => undefined)is therefore typed asPromise<undefined>while resolving tonull. Either reject/forbid undefined results in the authoring type or preserve the value through a wire representation that can round-trip it.
packages/page/src/page-verb-registry.ts:67 - The serializability check accepts non-plain objects because
Object.values(new Date()),Object.values(new Map()), andObject.values(new Set())are empty. RPC JSON encoding then converts these results to a string or{}, so the fully typed caller receives a different runtime type. It also accepts sparse arrays, which JSON converts by filling holes withnull. Restrict accepted objects to plain records/dense arrays (including symbol/extra-property checks), or validate an actual round trip.
packages/plugin/src/core/extensions-watch.ts:38 - A generation error escapes this Chokidar event callback. For example, an editor rename can briefly leave both
foo.tsandfoo.tsx;assertUniqueStemsthrows, and the uncaught EventEmitter callback can terminate the Next dev process instead of reporting the invalid extension set and recovering on the next event. Catch generation failures inside watcher callbacks and log them while keeping the watcher alive.
packages/plugin/src/core/vite.ts:33 - Subscriber exceptions propagate through the Vite internals that call
emit. A framework event handler that throws can preventclientHot.sendfrom forwarding an HMR/error payload, and a throw from the responsefinishlistener can become an uncaught process exception. Isolate each diagnostic listener so one extension cannot disrupt Vite or other subscribers.
packages/extensions/tanstack/src/client/router-adapter.ts:130 fullPathis the route pattern (for example/posts/$postId), while a live TanStackRouteMatchalso exposespathname(for example/posts/42). SincerouteIdalready identifies the route pattern and the contract's fake adapter uses the concrete matched path, this currently loses the actual path the user is viewing.
packages/plugin/src/core/extensions-entry.ts:6- The repository's hard style rules prohibit em dashes, including inside strings. Replace this generated header text with a hyphen and update its assertions in
packages/plugin/test/extensions-entry.it.test.ts.
| function encodedSegment(url: string): string | null { | ||
| if (!url.startsWith(SERVER_FN_PREFIX)) return null | ||
| const rest = url.slice(SERVER_FN_PREFIX.length) | ||
| const end = rest.search(/[/?#]/) |
| function resolveFile(baseDir: string, spec: string | undefined): string | null { | ||
| if (!spec) return null | ||
| return resolve(baseDir, spec) |
…import abort in the widget boot gate
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 260 out of 263 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (2)
apps/conciv/src/router.ts:43
- A client factory exception still escapes
createInstances, so one broken folder-installed extension aborts router/widget boot and also strands disposers from any factories that ran earlier. The server side now isolates this failure, but the client path needs the same per-extension boundary.
const result = extension.__client?.()
packages/page/src/page-verb-registry.ts:66
- This accepts non-plain objects such as
Date,Map, andSet:Object.valuesis empty for them, although JSON converts a Date to a string and Map/Set to{}. A typed page verb can therefore resolve to a different runtime type after the page-channel serialization. Reject non-plain object prototypes before traversing their values.
…side the dynamic-import abort
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 260 out of 263 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (4)
packages/core/src/chat/gate.ts:169
- Risky extension tools are registered under dotted names such as
canvas.delete, but bridged calls arrive asmcp__tanstack__canvas_delete(and OpenCode-styletanstack_canvas_delete). Removing only the MCP prefix leavescanvas_delete, so this returns false and bypasses the approval gate; Codex now auto-approves the bridge, making this the only guard for these destructive tools. Resolve bridged names back to the registered tool name before testing the risky set.
packages/extension-compiler/src/dedupe-extensions.ts:2 - The release note advertises
isExtensionfrom the published@conciv/extension-compiler/dedupesubpath, but this entry only imports it for internal use and never re-exports it. Consumers following the advertised API get a missing-export error.
packages/plugin/src/core/extensions-watch.ts:38 writeExtensionsEntrycan throw synchronously (for example, when a live edit creates duplicate extension stems). Throwing from these chokidar callbacks is uncaught and can terminate the Next.js dev process instead of preserving the last valid generated entry. Catch and report regeneration failures in both callbacks.
packages/plugin/src/core/extensions-entry.ts:6- The repository's text style disallows em dashes, including generated strings. Use a plain hyphen in this generated header.
| const dot = file.lastIndexOf('.') | ||
| return dot === -1 ? file : file.slice(0, dot) | ||
| } |
There was a problem hiding this comment.
False positive: the generator builds import specifiers from the string literal ../conciv/extensions/${stem} (extensions-entry.ts:38) — path.relative is not involved anywhere in this module, so no backslashes can appear on Windows. The other two findings (serverFn basepath, route-manifest extensionless file) were real and are fixed in f9a1c7a.
…nifest resolves real file extensions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 262 out of 265 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (4)
packages/extensions/tanstack/src/client/router-adapter.ts:130
- TanStack route matches expose the resolved URL as
pathname, whilefullPathbelongs to route definitions. Readingmatch.fullPaththerefore leaves every live match'spathempty (the real-app test only assertsrouteId), soFrameworkAdapter.client.routes.current()and RouterStateCard lose the matched path.
packages/page/src/page-verb-registry.ts:45 - This converts a valid handler result of
undefinedtonull.PageCallerstill infersPromise<undefined>from that handler, so the fully typed API resolves with a different value than its declared type. Keep the original value so the serializability guard rejects it; authors can explicitly returnnullfor a void payload.
packages/page/src/page-verb-registry.ts:67 Object.valuestreats non-plain objects such asMapandDateas serializable because they have no enumerable values. The page reply then JSON-converts them to{}or a string, so a caller typed as receivingMap/Dategets a different value. Reject non-array, non-plain objects here; verbs that need these values can returndehydrate(...)output.
packages/page/src/page-verb-registry.ts:41- Malformed
argsJsonis silently replaced with{}. Consequently a no-argument or all-optional verb executes successfully even though the wire arguments are invalid, instead of returning the promisedinvalid-argserror. Preserve JSON parse failure as an invalid-args dispatch result rather than coercing it.
What this is
Three stacked deliverables:
Extension browser-verb capability (
@conciv/extension+@conciv/page+ core) — a general, typed, declarative way for any extension to expose browser-side "verbs" that its own server tools invoke over the existing page channel. Extensions declare zod-validatedpageVerbsin.client(...); server tools call them via a scoped, fully-typedserver.page.call(verb, args)that rejects with a typedPageVerbError. Core gains exactly one genericextpage-query kind — no framework-specific code.@conciv/extension-tanstack— a framework-inspection adapter giving agents live, devtools-grade read + act access to a running TanStack Router/Start app, built entirely on capability chore: version packages (0.0.2) #1 and assembled behind the cross-frameworkFrameworkAdaptercontract.First-party extension install — published extensions become installable:
npm i @conciv/extension-tanstack, one re-export file inconciv/extensions/, done — on Vite frameworks AND Next.js (Turbopack + webpack).Landed and reviewed (each task: failing test → implement → spec+quality review → fix loop)
Browser-verb capability (complete):
extpage-query wire; browser verb registry with zod-validated dispatch and structured errors.definePageVerbs/pageVerb(schema, handler)/PageCaller/PageVerbError.server.page.callis typed against each extension's own verbs.PageBus-backedserver.page.callend to end, with typed error mapping for every failure path (no-widget/unknown-verb/invalid-args/handler-error/timeout).TanStack adapter — client half (complete), all proven against a REAL running TanStack app (no mocks):
rootFibers→memoizedProps.router), payloads dehydrated.tanstack_router_state,tanstack_route_tree,tanstack_loader_data(with a verified dehydrate depth-cap truncation proof),tanstack_query_cache, and the action toolstanstack_navigate/tanstack_invalidate/tanstack_back/tanstack_query_invalidate/tanstack_query_refetch.server.page.call→ page bus → fiber-walk on the live app → card.TanStack adapter — server half (complete):
BundlerBridgediagnostic stream (subscribe→ build-error / hmr-update / request-trace), captured once in the conciv vite plugin and threaded to the extensionServerApi. Framework-agnostic: a future Next.js adapter reads the same stream.tanstack_build_errors(fed by the diagnostic stream),tanstack_route_manifest(parsesrouteTree.genoff disk), andtanstack_server_fn_trace(generic request-trace filtered to/_serverFn/, base64-decoded to{file, export}, capped trace ring) — all tested against a real vite dev server.FrameworkAdapter contract (complete — Task 9, executed redefined):
@conciv/protocolframework-typescontract finalized: client-facing methods asyncified (the adapter lives server-side over asyncpage.call),client.errors.subscribedropped (push delivery is a separate cross-framework event-pipeline plan),routes.current()returns{location, matches},server.errors.snapshot()added.makeTanstackAdapterassembled viadefineFrameworkAdapterwithcapabilities {queryCache: true, serverFunctions: true, rscPayload: false, isr: false, middleware: false}; every tool reads through the adapter object — no direct page calls or ring closures in tool handlers.client.detect(),client.data.*(router loader cache, per-routeinvalidate({filter})verified against the dep source),client.errors.snapshot()(browser runtime-error ring). Honest minimal where the runtime has nothing:detect.version = null,server.logs.tail() = [](flagged, not faked).makeFakeFrameworkAdapter(overrides)in@conciv/extension-testkit— a complete, strictly-typed canned adapter for consumers testing against the contract.First-party extension install (complete):
.resolvesbrowser→ client build,import→ server build;./client/./server/./package.jsonsubpaths kept by convention.@conciv/extension-compiler:dedupeExtensions/toSortedEntries(/dedupesubpath, resolved to the dist file in consumer apps so packed installs boot) and onelistExtensionFilesfs primitive shared by the server loader and the Next generator.conciv/extensions/*viaimport.meta.globand dedupes against builtins. Next.js: gate-proven that Turbopack cannot glob fromnode_modules, sowithConcivwrites an app-local generated entry (.conciv/extensions-client.gen.tsx) and aliases@conciv/app-extensionsto it on both Turbopack and webpack;register()watchesconciv/and regenerates live.callTool) and a packed GA Next 16.2 fixture (fresh tarball closure, both bundlers, dev + build, watcher-live regeneration, and a degradation probe proving the tanstack extension returns a clean typed miss in a router-less app).@conciv/extension-compiler/dedupespecifier broke widget boot for all dist-mode consumers (now resolved to an absolute dist path), and Next compiled the node-only engine graph into the edge instrumentation build (withConcivnow stubs the register entry whennextRuntime === 'edge').docs/extending/install-first-party), changeset covering the 8 touched packages, examples wired (tanstack-start + nextjs), follow-up issues filed: conciv extensions add <name> — shadcn-style CLI to install first-party extensions #136 (install CLI), Baked built-in extensions on Next.js (parity with Vite @conciv/it) #137 (Next builtin extensions), Detection-gated tool/surface visibility (only advertise framework tools when detected) #138 (detection-gated tool visibility), Workspace Next.js dev apps 500 on a clean .next — engine graph bundled into the instrumentation compile (serverExternalPackages ignores workspace symlinks) #139 (pre-existing workspace Next dev 500 — reproduced onmain, not introduced here; packed/production installs are unaffected and proven green).Testing posture
Every browser/adapter behavior is exercised against a real running app in real Chromium (or a real vite dev server for the server-half) — no mocks, no jsdom, no hand-rolled substitute apps. The extension-testkit was generalized so each consumer supplies and runs its own real app via a
hostcallback (recorder/whiteboard/terminal migrated, all real-browser suites green).Gates (full branch)
pnpm typecheck83/83 ·pnpm build54/54 ·pnpm lint87/87 ·turbo run test --force94/94 ·fallow audit --changed-since mainverdict pass, 0 introduced findings · publint + attw 49/49 across the published set · changeset included.The final whole-branch review completed; all must-fix findings are resolved on this branch.
Note on branch composition
This branch stacks the framework-inspection work (30 commits, from the
FrameworkAdaptercontract through the adapter assembly) on top of ~36 earlier commits of prior unmerged work that also aren't inmainand are intended to merge together here:ui-kit-chat-tools) — ~13 commitsThe first-party extension install work adds a further 33 commits on top. The
main-based diff therefore includes all ~99 commits, by intent.🤖 Generated with Claude Code